Fix import error for rgb_to_grayscale#677
Open
sipsmehta wants to merge 1 commit intoXPixelGroup:masterfrom
Open
Fix import error for rgb_to_grayscale#677sipsmehta wants to merge 1 commit intoXPixelGroup:masterfrom
sipsmehta wants to merge 1 commit intoXPixelGroup:masterfrom
Conversation
The import statement for rgb_to_grayscale was referencing the torchvision.transforms.functional_tensor module, which is not available in the current version of torchvision. Updated the import statement to use torchvision.transforms.functional instead, resolving the ModuleNotFoundError. This commit fixes the issue where the script was failing to run due to the missing module. The change ensures compatibility with the installed version of torchvision and allows the script to execute successfully.
|
This might break installations depending on older version of try:
from torchvision.transforms.functional import rgb_to_grayscale
except ImportError:
try:
from torchvision.transforms.functional_tensor import rgb_to_grayscale
except ImportError:
raise ImportError("Failed to import rgb_to_grayscale from torchvision. Ensure you have a compatible version of torchvision installed.") |
atisandev
added a commit
to atisandev/VQFR
that referenced
this pull request
May 12, 2024
…ensor deprecation in 2024 January Since 2024 January v0.17.0 of torchvision, the module torchvision.transforms.functional_tensor is removed and the module torchvision.transforms.functional is available. https://github.com/pytorch/vision/releases/tag/v0.17.0 The code is proposed by @Elawfant in this issue of BasicSR: XPixelGroup/BasicSR#677
allgoodthings
pushed a commit
to allgoodthings/models
that referenced
this pull request
Jan 7, 2026
basicsr 1.4.2 imports from torchvision.transforms.functional_tensor, which was removed in torchvision 0.17+. This fix creates a dummy module at runtime so basicsr can import rgb_to_grayscale. References: - XPixelGroup/BasicSR#677 - xinntao/Real-ESRGAN#859 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
This is a duplicate of #650 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The import statement for rgb_to_grayscale was referencing the torchvision.transforms.functional_tensor module, which is not available in the current version of torchvision. Updated the import statement to use torchvision.transforms.functional instead, resolving the ModuleNotFoundError.
This commit fixes the issue where the script was failing to run due to the missing module. The change ensures compatibility with the installed version of torchvision and allows the script to execute successfully.